From 3645dec05616d68a280a7e7a681bc58637e4c64a Mon Sep 17 00:00:00 2001 From: "vhanquez@kneesa.uk.xensource.com" Date: Wed, 15 Mar 2006 12:24:34 +0000 Subject: [PATCH] fix buffer overflow in print XS_DEBUG command Signed-off-by: Vincent Hanquez --- tools/xenstore/xenstored_core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 7076046801..afede2f454 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1115,8 +1115,17 @@ static void do_set_perms(struct connection *conn, struct buffered_data *in) static void do_debug(struct connection *conn, struct buffered_data *in) { - if (streq(in->buffer, "print")) + int num; + + num = xs_count_strings(in->buffer, in->used); + + if (streq(in->buffer, "print")) { + if (num < 2) { + send_error(conn, EINVAL); + return; + } xprintf("debug: %s", in->buffer + get_string(in, 0)); + } if (streq(in->buffer, "check")) check_store(); #ifdef TESTING -- 2.30.2